﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;



public partial class modules_CS_ICManagement_DownTemp : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }

    }
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        
        string UserAgent = Request.ServerVariables["http_user_agent"].ToLower();
        string FileName = "员工导入模板.xls";
        if (UserAgent.IndexOf("firefox") == -1)
            FileName = HttpUtility.UrlEncode(FileName, Encoding.UTF8);
        Response.AppendHeader("content-type", "application/octet-stream");
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
        Response.WriteFile("~/Files/StaffTemp/员工导入模板.xls");
        Response.Flush();
        Response.End();


        //System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("~/Files/StaffTemp/员工导入模板.xls"));
        //Response.Clear();
        //Response.Charset = "GB2312";
        //Response.ContentEncoding = System.Text.Encoding.UTF8;
        ////   添加头信息，为"文件下载/另存为"对话框指定默认文件名   
        //Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name));
        ////   添加头信息，指定文件大小，让浏览器能够显示下载进度   
        //Response.AddHeader("Content-Length", file.Length.ToString());
        ////   指定返回的是一个不能被客户端读取的流，必须被下载   
        //Response.ContentType = "application/ms-access";
        ////   把文件流发送到客户端   
        //Response.WriteFile(file.FullName);
        ////   停止页面的执行   
        //Response.End();



    }
}